#include"Queue.h"
#include"BTNode.h"

BTNode* BuyTreeNode(char x)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	assert(node);

	node->_data = x;
	node->_left = NULL;
	node->_right = NULL;

	return node;
}

BTNode* CreateTree()
{
	BTNode* node1 = BuyTreeNode('a');
	BTNode* node2 = BuyTreeNode('b');
	BTNode* node3 = BuyTreeNode('c');
	BTNode* node4 = BuyTreeNode('d');
	BTNode* node5 = BuyTreeNode('e');
	BTNode* node6 = BuyTreeNode('f');
	BTNode* node7 = BuyTreeNode('g');

	node1->_left = node2;
	node1->_right = node4;
	node2->_left = node3;
	node4->_left = node5;
	node4->_right = node6;
	node2->_right = node7;

	return node1;
}



int main()
{
	BTNode* root = CreateTree();
	BinaryTreePrevOrder(root);
	printf("\n");

	BinaryTreeInOrder(root);
	printf("\n");

	printf("BinaryTreeSize:%d\n", BinaryTreeSize(root));
	printf("BinaryTreeSize:%d\n", BinaryTreeSize(root));

	printf("BinaryTreeLeafSize:%d\n", BinaryTreeLeafSize(root));
	printf("BinaryTreeHeight:%d\n", BinaryTreeHeight(root));
	printf("BinaryTreeLevelKSize:%d\n", BinaryTreeLevelKSize(root, 3));

	BTNode* ret = BinaryTreeFind(root, 'd');
	printf("BinaryTreeFind:%p\n", ret);

	printf("BinaryTreeComplete:%d\n", BinaryTreeComplete(root));

	BinaryTreeDestory(&root);

}